package com.hello.sky.controller.user;

import com.hello.sky.model.entity.SetmealDish;
import com.hello.sky.model.vo.SetmealVO;
import com.hello.sky.result.Result;
import com.hello.sky.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController("userSetmealController")
@RequestMapping("/user/setmeal")
public class SetmealController {

    @Autowired
    private SetmealService setmealService;

    @GetMapping("/list")
    public Result getSetmealDishByCategoryId(@RequestParam("categoryId")Integer id){
        List<SetmealVO> setmealVOList = setmealService.getSetmealByCategoryIdResVo(id);
        return Result.success(setmealVOList);
    }

    @GetMapping("/dish/{setmealId}")
    public Result getSetmealDishBySetmealId(@PathVariable("setmealId") Long setmealId){
        List<SetmealDish> setmealDishList = setmealService.getSetmealDishBySetmealId(setmealId);
        return Result.success(setmealDishList);
    }
}
